<?php get_header() ?>

<div class="row">
    <div class="col-sm-6 col-lg-5 col-12 header-description">
        <div class="slogan-kk">
            <img src="<?php echo bloginfo('template_url'); ?>/img/banner-text.png">
        </div>
        <div class="visible-sm slider">
            <div id="carousel-example-slidehomesm" class="carousel slide">
              <!-- Indicators -->
              <?php $picture = nggdb::find_last_images(0,100,true,7); ?>
              <ol class="carousel-indicators">
              <?php
                foreach($picture as $key=>$row){ ?>
                <li data-target="#carousel-example-slidehomesm" data-slide-to="<?php echo $key; ?>" class="<?php if($key==0) echo 'active' ?>"></li>
                <?php } ?>
              </ol>

              <!-- Wrapper for slides -->
              <div class="carousel-inner">
              <?php 
                foreach($picture as $key=>$row){ 
                    $_ngiw = $row->_ngiw; 
                    $_cache = $_ngiw->_cache;
                    $path = $row->get_permalink();  
                    $path = explode('wp-content', $path);
                    $imgpath = site_url().'/wp-content'.$path[1]; ?>
                    <div class="item <?php if($key==0) echo 'active' ?>">
                      <img alt="<?php echo    $_cache['alttext'];  ?>" src="<?php echo $imgpath; ?>">
                    </div>
                <?php } ?>
              </div>
              <!-- Controls -->
              <a class="left carousel-control" href="#carousel-example-slidehomesm" data-slide="prev" style="display:none;">
                <span class="icon-prev"></span>
              </a>
              <a class="right carousel-control" href="#carousel-example-slidehomesm" data-slide="next" style="display:none;">
                <span class="icon-next"></span>
              </a>
            </div>
        </div>
        <h2 style="display:none;">Thời trang công sở K&K FASHION 
            <span class="google-plus"><script type="text/javascript" src="https://apis.google.com/js/plusone.js" gapi_processed="true">{lang: 'vi'}</script><g:plusone></g:plusone></span>
        </h2>                        
        <span class="" style="display:none;">Thời trang nữ ♥ Thời trang công sở hè 2013: Hãy đến với K&K Fashion và chọn cho mình những bộ trang phục công sở thật xinh đẹp và đáng yêu cho mùa thời trang hè 2013 này nhé. Mùa hè 2013 đã đến, mùa hè là mùa mà ngành thời trang nữ luôn có sự biến đổi về phong cách cũng như xu hướng.</span>
        <div class="youtube-video" style="margin-top:40px;">
            <iframe width="100%" height="280" src="http://www.youtube.com/embed/6LeznD3dkCc" frameborder="0" allowfullscreen></iframe>
        </div>
    </div>
    <div class="col-sm-6 col-lg-7 col-12 hidden-sm homeslideshow">
        <div id="carousel-example-slidehome" class="carousel slide">
          <!-- Indicators -->
          <ol class="carousel-indicators">
          <?php
            foreach($picture as $key=>$row){ ?>
            <li data-target="#carousel-example-slidehome" data-slide-to="<?php echo $key; ?>" class="<?php if($key==0) echo 'active' ?>"></li>
            <?php } ?>
          </ol>

          <!-- Wrapper for slides -->
          <div class="carousel-inner">
          <?php
            foreach($picture as $key=>$row){ 
                 $_ngiw = $row->_ngiw;   
                    $_cache = $_ngiw->_cache; 
                $path = $row->get_permalink();
                $path = explode('wp-content', $path);
                $imgpath = site_url().'/wp-content'.$path[1]; ?>
                <div class="item <?php if($key==0) echo 'active' ?>">
                  <img alt="<?php echo  $_cache['alttext'];  ?>" src="<?php echo $imgpath; ?>">
                </div>
            <?php } ?>
          </div>
          <!-- Controls -->
          <a class="left carousel-control" href="#carousel-example-slidehome" data-slide="prev" style="display:none;">
            <span class="icon-prev"></span>
          </a>
          <a class="right carousel-control" href="#carousel-example-slidehome" data-slide="next" style="display:none;">
            <span class="icon-next"></span>
          </a>
        </div>
    </div>
</div>
</div>
</div>

<div class="hotline-home hotline">
<?php get_sidebar('hotline') ?>                
</div>
<!-- Content -->
<div class="container">

<div class="row">
<?php
  wp_reset_query();
  $posts_per_page = 6;
  query_posts(array('posts_per_page'=>$posts_per_page));
  while (have_posts()): the_post(); 
    if (has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
       $url_to_image = $large_image_url[0];
    } else {
     $url_to_image = bloginfo('template_url').'/img/no-image-blog-one.png';
    }
     $abs_image = str_replace('http://'.$_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $url_to_image);
      if(!file_exists($abs_image)) $url_to_image = str_replace('E12', 'E 12', $url_to_image );
      $abs_image = str_replace('http://'.$_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $url_to_image);
      if(!file_exists($abs_image)) $url_to_image = site_url().'/wp-content/uploads/no_image.jpg';
  ?>
    <div class="col-lg-4 col-sm-6 col-12">
        <div class="news-item">
            <div class="news-thumb">
			<a href="<?php the_permalink() ?>">
                <img src="<?php echo $url_to_image ?>" />
				</a>
            </div>
            <div class="news-title"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></div>
            <div class="news-description">
                <?php the_excerpt(''); ?> 
            </div>
            <div class="read-more">
                <a href="<?php the_permalink() ?>">&raquo; Chi tiết</a>
            </div>

        </div>
    </div>
 <?php endwhile; ?>

</div>
</div>
<style type="text/css">
  .hotline-home{
    margin-bottom: 30px;
  }
@media (max-width: 767px){
  .carousel-indicators{
    display: none;
  }
}
</style>
<script type="text/javascript">
  $('.carousel').carousel({
    interval: 5000
  })
</script>
<?php get_footer() ?>